// 研究 Boolean 类

let names ;

console.log( '- - - - - Boolean静态属性 - - - - -' );

names = Object.getOwnPropertyNames( Boolean );
console.log( names );

console.log( '- - - - - Boolean原型属性 - - - - -' );

names = Object.getOwnPropertyNames( Boolean.prototype );
console.log( names );

console.log( '- - - - - Boolean构造函数 - - - - -' );

console.log( '没有参数: ' , new Boolean() );
console.log( '参数为 0: ' , new Boolean(0) );
console.log( '参数为 -0: ' , new Boolean(-0) );
console.log( '参数为 null: ' , new Boolean( null ) );
console.log( '参数为 false: ' , new Boolean(false) );
console.log( '参数为 undefined: ' , new Boolean(undefined) );
console.log( '参数为 空字符串: ' , new Boolean('') );

console.log( '' );

console.log( new Boolean( 'false' ) );
console.log( new Boolean( [] ) );
console.log( new Boolean( {} ) );

console.log( '- - - - - Boolean原型函数 - - - - -' );

let liangmei = { name: '朱亚红' }
let b = new Boolean( liangmei );
console.log( b );
console.log( b.toString() , typeof b );

// 取得 b 所指向实例中所包裹的原始值
let p = b.valueOf();
console.log( p , typeof p );

console.log( '- - - - - 将Boolean构造函数用作普通函数 - - - - -' );

let array = [ '郑娅婷' , '赵婷' , '朱亚红' ];
let result = Boolean( array ); // 将非boolean值转换为boolean值
console.log( result , typeof result );